<?php if (!isset($v_sval)) exit; ?>
<?php
	$imag = (isset($_REQUEST["imag"])) ? $_REQUEST["imag"] : "" ;
	
	switch($imag){
		case "A";
			include "qry_all_image.php";
			include "account/header.php";
			include "dsp_all_image.php";
			include "account/footer.php";
			break;
		case "IMIF";
			include "ajax_load_image_info.php";
			break;
		case "D";
			include "act_delete_image.php";		
			break;
		case "U";
			include "act_update_image.php";		
			break;
		default ;
			include "qry_all_image.php";
			include "account/header.php";
			include "dsp_all_image.php";
			include "account/footer.php";
	}

	function insertImage(
		$p_album_id
			,$p_image_location
			,$p_account_id
	
	){
		mysql_query("
			INSERT INTO TB_IMAGE(
				ALBUM_ID
					,IMAGE_LOCATION
					,ACCOUNT_ID
	
			)VALUES(
				'".$p_album_id."'
					,'".$p_image_location."'
					,'".$p_account_id."'
	
			)	
		")or die(mysql_error());
		return mysql_insert_id();
	}
	
	function updateImage(
		$p_image_id
			,$p_album_id
			,$p_image_location
			,$p_account_id
	
	){
		mysql_query("
			UPDATE TB_IMAGE 
			SET
				ALBUM_ID='".$p_album_id."'
					,IMAGE_LOCATION='".$p_image_location."'
					,ACCOUNT_ID='".$p_account_id."'
	
			WHERE IMAGE_ID =  '".$p_image_id."'
		");
	}

	function getAllImage($p_where_clause,$p_offset,$p_num_row,$p_order_by=" IMAGE_ID DESC "){
		$rs = mysql_query("
		SELECT 
			IMAGE_ID
				,ALBUM_ID
				,IMAGE_LOCATION
				,ACCOUNT_ID

		FROM TB_IMAGE	
		WHERE 1 ".$p_where_clause."		
		ORDER BY ".$p_order_by."
		LIMIT ".$p_offset.",".$p_num_row."
		")or die(mysql_error());
		return $rs;
	}

	function getSingerImage($p_image_id){
		$rs = mysql_query("
		SELECT 
			IMAGE_ID
				,ALBUM_ID
				,IMAGE_LOCATION
				,ACCOUNT_ID

		FROM TB_IMAGE	
		WHERE IMAGE_ID =  '".$p_image_id."'		
		")or die(mysql_error());
		return $rs;
	}

?>	
